package biz

import (
	"context"
	"time"

	"github.com/Fromsko/gouitls/auth"
	"github.com/go-kratos/kratos/v2/log"
)

// UserInfo 表结构定义
type UserInfo struct {
	UserID    string    `gorm:"primarykey;autoIncrement;comment:用户ID"`
	Username  string    `gorm:"unique;not null;comment:用户名"`
	Password  string    `gorm:"not null;comment:密码"`
	Role      string    `gorm:"comment:角色"`
	Email     string    `gorm:"comment:邮箱"`
	CreatedAt time.Time `gorm:"comment:创建时间"`
	UpdatedAt time.Time `gorm:"comment:更新时间"`
}

type UserRepo interface {
	Delete(context.Context, string) error
	Query(context.Context, string) (*UserInfo, error)
	Create(context.Context, *UserInfo) (*UserInfo, error)
	Update(context.Context, *UserInfo) (*UserInfo, error)
	QueryList(ctx context.Context, role string) ([]UserInfo, error)
}

type UserCase struct {
	repo       UserRepo
	log        *log.Helper
	subscriber *auth.SubscriberAuth
}
